﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using CractalLibrary;
using System.Linq;

namespace DictionaryGenTest
{
    [TestClass]
    public class cractaltest
    {
        [TestMethod]
        public void Roughdivideby()
        {
            //should act exactly like an integer
            cractal testcracktal = new cractal(new char[] { '0', '1', '2','3','4','5','6','7','8','9' });
            var an = testcracktal.RoughDivideBy(new char[] { '9', '9' }, 49);
            
            testcracktal = new cractal();

            //var d = testcracktal.RoughDivideBy(new char[] { '~', '~', '~', '~', '~', '~', '~', '~', '~', '~', '~', '~', '~', '~', '~', '~', '~', '~', '~', '~', '~' },4);

                Assert.IsTrue(Enumerable.SequenceEqual(an,new char[]{'2'}));
            
        }

        [TestMethod]
        public void RoughdividebyA()
        {
            //should act exactly like an integer
            cractal testcracktal = new cractal(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' });
                        
            var an = testcracktal.RoughDivideBy(new char[] { '9', '6', '2', '7' }, 4);
            
            testcracktal = new cractal();

           

            Assert.IsTrue(Enumerable.SequenceEqual(an, new char[] { '2','4','0','6' }));

        }

        [TestMethod]
        public void RoughdividebyB()
        {
            //should act exactly like an integer
            cractal testcracktal = new cractal(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' });

            var an = testcracktal.RoughDivideBy(new char[] { '2', '2', '2', '2' }, 2); //no caryover values that involve zero. // just modulus
           
           

            Assert.IsTrue(Enumerable.SequenceEqual(an, new char[] { '1', '1', '1', '1' }));

        }

        [TestMethod]
        public void RoughdividebyC()
        {
            //should act exactly like an integer
            cractal testcracktal = new cractal(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' });


            var an = testcracktal.RoughDivideBy(new char[] { '1', '1', '1', '1' }, 2);
            

           

            Assert.IsTrue(Enumerable.SequenceEqual(an, new char[] { '5', '5', '5' }));

        }

        [TestMethod]
        public void AddA()
        {
            cractal testcracktal = new cractal(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' });

            var radds = testcracktal.ADD(new char[] { '9' }, new char[] { '1' });

            Assert.IsTrue(Enumerable.SequenceEqual(radds,new char[] { '1', '0' }));
        }


        [TestMethod]
        public void AddB()
        {
            cractal testcracktal = new cractal(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' });

            var radd = testcracktal.ADD(new char[] { '2', '2', '2' }, new char[] { '9', '9', '0' });

            Assert.IsTrue(Enumerable.SequenceEqual(radd,new char[] { '1', '2', '1', '2' }));
        }

        [TestMethod]
        public void AddC()
        {
            cractal testcracktal = new cractal(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' });

            var rad = testcracktal.ADD(new char[] { '9', '9' }, new char[] { '9', '9', '9' });

            Assert.IsTrue(Enumerable.SequenceEqual(rad, new char[] { '1', '0', '9', '8' }));
        }

        [TestMethod]
        public void AddD()
        {
            cractal testcracktal = new cractal(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' });

            var rad = testcracktal.ADD(new char[] { '4', '9','9', '9' }, new char[] { '2', '4', '9','9' });

            Assert.IsTrue(Enumerable.SequenceEqual(rad, new char[] { '7', '4', '9', '8' }));
        }
    }
}

